package com.xhh.nphm.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xhh.nphm.system.domain.MmailGetDealEty;
import com.xhh.nphm.system.mapper.MailGetDealMapper;
import com.xhh.nphm.system.service.IMailGetDealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class MailGetDealServiceImpl extends ServiceImpl<MailGetDealMapper, MmailGetDealEty> implements IMailGetDealService {

    @Autowired
    private MailGetDealMapper mailGetDealMapper;
    @Override
    public List<MmailGetDealEty> getMailGetDealList(MmailGetDealEty mmailGetDealEty) {
        return mailGetDealMapper.getMailGetDealList(mmailGetDealEty);
    }

    @Override
    public List<MmailGetDealEty> getAbolishList(MmailGetDealEty mmailGetDealEty) {
        return mailGetDealMapper.getAbolishList(mmailGetDealEty);
    }

    @Override
    public List<MmailGetDealEty> getDistributeList(MmailGetDealEty mmailGetDealEty) {
        return mailGetDealMapper.getDistributeList(mmailGetDealEty);
    }

    @Override
    public List<MmailGetDealEty> getAcceptanceList(MmailGetDealEty mmailGetDealEty) {
        return mailGetDealMapper.getAcceptanceList(mmailGetDealEty);
    }

    @Override
    public List<MmailGetDealEty> getWaitList(MmailGetDealEty mmailGetDealEty) {
        return mailGetDealMapper.getWaitList(mmailGetDealEty);
    }

    /**
     * 后台录入信件查询
     * @param mmailGetDealEty
     * @return
     */
    @Override
    public List<MmailGetDealEty> entryMailList(MmailGetDealEty mmailGetDealEty) {
        return mailGetDealMapper.mailList(mmailGetDealEty);
    }

    @Override
    public int deleteAll(String[] ids) {
        return mailGetDealMapper.deleteBatchIds(Arrays.asList(ids));
    }

    @Override
    public MmailGetDealEty selectByPkId(Integer pkId) {
        return mailGetDealMapper.selectById(pkId);
    }

    @Override
    public int updateMail(MmailGetDealEty mmailGetDealEty) {
        return mailGetDealMapper.updateById(mmailGetDealEty);
    }

    @Override
    public int countSNbyDate(String cYear, String cMth, String cDay) {
        return getBaseMapper().countSNbyDate(cYear, cMth, cDay);
    }

    /**
     * (网络理政区县)待处理信件M
     *
     * @param mmailGetDealEty 查询条件
     * @return 列表数据
     */
    @Override
    public List<Map<String, Object>> listWaitGetXZJson(MmailGetDealEty mmailGetDealEty,String deptId) {
        HashMap<String,Object> params = new HashMap<>();
        params.put("mail",mmailGetDealEty);
        params.put("deptId",deptId);
        return getBaseMapper().listWaitGetXZJson(params);
    }

    /**
     * 下级收到来信M
     *
     * @param mmailGetDealEty 查询条件
     * @param areaNo          地区编号
     * @param noParent        用户从属编号
     * @return 列表数据
     */
    @Override
    public List<Map<String, Object>> listThirdMailJson(MmailGetDealEty mmailGetDealEty, String areaNo, String noParent) {
        HashMap<String,Object> params = new HashMap<>();
        params.put("mail",mmailGetDealEty);
        params.put("areaNo",areaNo);
        params.put("noParent",noParent);
        return getBaseMapper().listThirdMailJson(params);
    }

    /**
     * (网络理政区县)已处理的信件M
     *
     * @param mmailGetDealEty 查询条件
     * @param deptId
     * @return
     */
    @Override
    public List<Map<String, Object>> myGetListXZJson(MmailGetDealEty mmailGetDealEty, String deptId) {
        HashMap<String,Object> params = new HashMap<>();
        params.put("mail",mmailGetDealEty);
        params.put("deptId",deptId);
        return getBaseMapper().myGetListXZJson(params);
    }

    /**
     * 通过信件id查询信件实体
     * @param PkId
     * @return
     */
    @Override
    public MmailGetDealEty selectByMailPkId(String PkId) {
        return mailGetDealMapper.selectByMailPkId(PkId);
    }
}
